<?php

/**
 * \class user_registration_handler
 * \brief This class handles user registration details.
 * \author  Salman Noor
 */
class user_registration_handler {

    /**
     * \brief private data member to access functionality defined in class
     * html_elements_builder.
     */
    private $html_buillder;

    /**
     * \brief Constructor to initialise private data variables html_builder.
     */
    public function __construct() {
        $this->html_buillder = new html_elements_builder();
    }

    /**
     * \brief This function builds html content for the registration window.
     * \return This returns the html content for the registration window.
     */
    private function buildRegistrationWindow() {
        $registrationWindow = "<div style ='font-size: 100%;' id='dialog-box-registration' title='Register As a New User'>";
        $registrationWindow .="<div style =' border: 1px solid transparent; padding: 7px' class='errorMessageDiv'> </div>";
        $registrationWindow .="<div class='responseDiv'> </div>";
        $registrationWindow .= "<form id='registrationForm' method='post' method='register_user' name='registration form'";
        $registrationWindow .= $this->html_buillder->buildTextInput('firstName', null, 'firstName', TRUE, "First Name", 'top') . "<br>";
        $registrationWindow .= $this->html_buillder->buildTextInput('lastName', null, 'lastName', TRUE, "Last Name", 'top') . "<br>";
        $registrationWindow .= $this->html_buillder->buildTextInput('emailAddress', null, 'emailAddress', TRUE, "Email Address", 'top') . "<br>";
        $registrationWindow .= $this->html_buillder->buildTextInput('userName', null, 'userName', TRUE, "User Name", 'top') . "<br>";
        $registrationWindow .= $this->html_buillder->buildPasswordInput('passwordField', null, 'passwordField', TRUE, "Password", 'top') . "<br>";
        $registrationWindow .= $this->html_buillder->buildPasswordInput('repeatPasswordField', null, 'repeatPasswordField', TRUE, "Repeat Password", 'top') . "<br>";
        $this->html_buillder->addOption('customer', 'Register as a Customer');
        $this->html_buillder->addOption('business', 'Register as Business User');
        $this->html_buillder->setSelected('customer');
        // $this->html_buillder->setBreakSpace('new line');
        $registrationWindow .= $this->html_buillder->buildRadioButton('userType', "Select what type of user you want to register as:");
        $registrationWindow .="</form>";
        $registrationWindow .= "</div>";
        return $registrationWindow;
    }

    /**
     * \brief This function builds html content for OK message of the
     * Registration box.
     * \return This returns  html content for OK message of the
     * Registration box.
     */
    private function buildRegistrationOKMessageBox() {
        return $this->html_buillder->buildSimpleDialogueBox('dialogue-registrationOKMessage', 'Registration is Successful', 'Your Registration was successful. An email with your login details have been sent to you.', 'ui-icon-circle-check');
    }

    /**
     * \brief This function builds html content for OK message of the
     * Registration box.
     * \return This returns  html content for OK message of the
     * Registration box.
     */
    public function showRegistrationWindow() {
        return $this->buildRegistrationWindow();
    }

    /**
     * \brief This function builds html content for OK message of the
     * Registration box.
     * \return This returns  html content for OK message of the
     * Registration box.
     */
    public function showRegistrationOKMessageBox() {
        return $this->buildRegistrationOKMessageBox();
    }

}
?>
